import { Vector3 } from "@minecraft/server";
import { CubeRegion } from "@sapi-game/gameRegion/gameRegion";
import { GameStructure } from "@sapi-game/main";
import { DimensionIds } from "@sapi-game/utils/vanila-data";

export interface PillarOfFortuneMap {
    name: string;
    id: string;
    watingPoint: Vector3;
    startPoints: Vector3[];
    structure: GameStructure;
    region: CubeRegion;
    center: Vector3;
}

const tntMap: PillarOfFortuneMap = {
    id: "tnt",
    name: "TNT跑酷",
    watingPoint: { x: 442.5, y: 10.0, z: 1043.5 },
    startPoints: [
        { x: 442, y: -21, z: 1031 },
        { x: 450, y: -21, z: 1035 },
        { x: 454, y: -21, z: 1043 },
        { x: 450, y: -21, z: 1051 },
        { x: 442, y: -21, z: 1055 },
        { x: 434, y: -21, z: 1051 },
        { x: 430, y: -21, z: 1043 },
        { x: 434, y: -21, z: 1035 },
    ],
    structure: new GameStructure("幸运之柱_地图_TNT", {
        x: 427,
        y: -61,
        z: 1028,
    }),
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 411, y: -64, z: 1011 },
        { x: 469, y: 5, z: 1070 }
    ),
    center: { x: 442, y: -22, z: 1043 },
};

const nether: PillarOfFortuneMap = {
    id: "nether",
    name: "地狱之柱",
    watingPoint: { x: 353, y: 35, z: 1210 },
    startPoints: [
        { x: 366, y: 0, z: 1210 },
        { x: 362, y: 0, z: 1219 },
        { x: 353, y: 0, z: 1223 },
        { x: 344, y: 0, z: 1219 },
        { x: 340, y: 0, z: 1210 },
        { x: 344, y: 0, z: 1201 },
        { x: 353, y: 0, z: 1197 },
        { x: 362, y: 0, z: 1201 },
    ],
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 381, y: -64, z: 1238 },
        { x: 325, y: 24, z: 1182 }
    ),
    structure: new GameStructure("幸运之柱_地图_地狱", {
        x: 337,
        y: -61,
        z: 1194,
    }),
    center: { x: 353, y: -20, z: 1210 },
};

const voidMap: PillarOfFortuneMap = {
    id: "void",
    name: "虚空之柱",
    watingPoint: { x: 455, y: 11, z: 1210 },
    center: { x: 455, y: -30, z: 1210 },
    startPoints: [
        { x: 445, y: -19, z: 1210 },
        { x: 448, y: -19, z: 1217 },
        { x: 455, y: -19, z: 1220 },
        { x: 462, y: -19, z: 1217 },
        { x: 465, y: -19, z: 1210 },
        { x: 462, y: -19, z: 1203 },
        { x: 455, y: -19, z: 1200 },
        { x: 488, y: -19, z: 1203 },
    ],
    structure: new GameStructure("幸运之柱_地图_虚空之柱", {
        x: 445,
        y: -59,
        z: 1200,
    }),
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 483, y: -64, z: 1238 },
        { x: 427, y: 0, z: 1182 }
    ),
};

const end: PillarOfFortuneMap = {
    id: "end",
    name: "末地之柱",
    watingPoint: { x: 454, y: 35, z: 1324 },
    startPoints: [
        { x: 454, y: 0, z: 1311 },
        { x: 445, y: 0, z: 1315 },
        { x: 441, y: 0, z: 1324 },
        { x: 445, y: 0, z: 1333 },
        { x: 454, y: 0, z: 1337 },
        { x: 463, y: 0, z: 1333 },
        { x: 467, y: 0, z: 1324 },
        { x: 463, y: 0, z: 1315 },
    ],
    center: { x: 454, y: -10, z: 1324 },
    structure: new GameStructure("幸运之柱_地图_末地", {
        x: 438,
        y: -61,
        z: 1308,
    }),
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 481, y: -64, z: 1351 },
        { x: 427, y: 22, z: 1297 }
    ),
};

const mushIsland: PillarOfFortuneMap = {
    id: "mushroom",
    name: "蘑菇岛",
    watingPoint: { x: 354, y: 40, z: 1325 },
    startPoints: [
        { x: 354, y: 0, z: 1313 },
        { x: 346, y: 0, z: 1317 },
        { x: 342, y: 0, z: 1325 },
        { x: 346, y: 0, z: 1333 },
        { x: 354, y: 0, z: 1337 },
        { x: 362, y: 0, z: 1333 },
        { x: 366, y: 0, z: 1325 },
        { x: 362, y: 0, z: 1317 },
    ],
    center: { x: 354, y: -8, z: 1325 },
    structure: new GameStructure("幸运之柱_地图_蘑菇岛", {
        x: 339,
        y: -60,
        z: 1310,
    }),
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 381, y: -64, z: 1352 },
        { x: 327, y: 18, z: 1298 }
    ),
};

const lush: PillarOfFortuneMap = {
    id: "Lush",
    name: "繁茂之地(24人)",
    structure: new GameStructure("幸运之柱_地图_繁茂之地", {
        x: 362,
        y: -55,
        z: 1417,
    }),
    startPoints: [
        { x: 418, y: 0, z: 1447 },
        { x: 416, y: 0, z: 1437 },
        { x: 411, y: 0, z: 1428 },
        { x: 402, y: 0, z: 1423 },
        { x: 392, y: 0, z: 1421 },
        { x: 382, y: 0, z: 1423 },
        { x: 373, y: 0, z: 1428 },
        { x: 368, y: 0, z: 1437 },
        { x: 366, y: 0, z: 1447 },
        { x: 368, y: 0, z: 1457 },
        { x: 373, y: 0, z: 1466 },
        { x: 382, y: 0, z: 1471 },
        { x: 392, y: 0, z: 1473 },
        { x: 402, y: 0, z: 1471 },
        { x: 411, y: 0, z: 1466 },
        { x: 416, y: 0, z: 1457 },
        { x: 404, y: 0, z: 1447 },
        { x: 401, y: 0, z: 1438 },
        { x: 392, y: 0, z: 1435 },
        { x: 383, y: 0, z: 1438 },
        { x: 380, y: 0, z: 1447 },
        { x: 383, y: 0, z: 1456 },
        { x: 392, y: 0, z: 1459 },
        { x: 401, y: 0, z: 1456 },
    ],
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 353, y: -64, z: 1408 },
        { x: 431, y: 17, z: 1486 }
    ),
    center: { x: 392, y: -10, z: 1447 },
    watingPoint: { x: 392.5, y: 34.0, z: 1447.5 },
};

export const PillarOfFortuneMaps = {
    tnt: tntMap,
    nether: nether,
    voidMap: voidMap,
    end: end,
    mushIsland: mushIsland,
    lush: lush,
};
